<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<body>
<%--通用的分页工具--%>
<div class="pull-left">
    <div class="form-group form-inline">
        总共${pb.pages}页，共${pb.total}条数据。 每页
        <select class="form-control">
            <option ${pb.pageSize==3?"selected":""}>3</option>
            <option ${pb.pageSize==5?"selected":""}>5</option>
            <option ${pb.pageSize==10?"selected":""}>10</option>

        </select> 条
    </div>
</div>

<div class="box-tools pull-right">
    <ul class="pagination">

        <c:if test="${pb.pageNum!=1}">
            <li>
                <a href="javascript:topage('1')"  aria-label="Previous">首页</a>
            </li>
            <li>
                <a href="javascript:topage('${pb.pageNum-1}')">上一页</a>
            </li>
        </c:if>


        <c:forEach begin="${pb.navigateFirstPage}" end="${pb.navigateLastPage}" var="page">
            <li><a href="javascript:topage('${page}')">${page}</a></li>
        </c:forEach>



        <c:if test="${pb.pageNum!=pb.pages}">
            <li>
                <a href="javascript:topage('${pb.pageNum+1}')">下一页</a>
            </li>
            <li>
                <a href="javascript:topage('${pb.pages}')" aria-label="Next">尾页</a>
            </li>
        </c:if>

    </ul>
</div>



<form id="formId" action="${param.pageUrl}" method="post">
    <input type="hidden" name="pageNum" value="1" id="pageNum">
</form>

<script>
    function topage(pageNum){
        // 获取每次传递的当前页
        $("#pageNum").val(pageNum);
        // 让表单提交
        $("#formId").submit();
    }
</script>
</body>
</html>
